# -*- coding: utf-8 -*-
# @Time    : 2022/7/27 17:54
# @Author  : Yanfeng
# @Email   : sxyanfeng2014@163.com
# @File    : customer_order_page_locs.py
# @Software: PyCharm


#客户订单页
from selenium.webdriver.common.by import By


class Customer_order:

    #frmain->iframeSubMenu
    frame_iframeSubMenu = (By.ID,'iframeSubMenu')

    # frmain->iframeSubMenu>all
    frame_all = (By.ID,'all')

    #  加号按钮
    button_add = (By.XPATH,'//div[text()="添加"]/preceding-sibling::img')

    #搜索按钮  //a[@id="butBaseSearch"]
    botton_search = (By.XPATH,'//a[@id="butBaseSearch"]')

    #平台订单号span   //tr[@class="datagrid-row"][1]//span[@name="spanClientOrderCode"]
    span_Platform_order_number =(By.XPATH,'//tr[@class="datagrid-row"][1]//span[@name="spanClientOrderCode"]')


#客户订单内嵌页-OpenIframeWin
class Customer_order_OpenIframeWin1:

    #frame: 先回退到父frame,在进入到下面的iframe
    frame_OpenIframeWin1 = (By.XPATH,'//iframe[@id="OpenIframeWin" and @src="/IrobotBox/Order/ClientOrderInfoEdit.aspx"]')


    #平台订单号输入框  //th[contains(text(),"平台订单")]//following::input[@id="_easyui_textbox_input1"]
    input_Platform_order_number = (By.XPATH,'//th[contains(text(),"平台订单")]//following::input[@id="_easyui_textbox_input1"]')

    #订单来源渠道下拉框按钮  //input[@id="_easyui_textbox_input49" and contains(@placeholder,"订单来源渠道")]/preceding-sibling::span/a
    button_ddlyqd_select = (By.XPATH,'//input[@id="_easyui_textbox_input49" and contains(@placeholder,"订单来源渠道")]/preceding-sibling::span/a')

    #订单来源渠道下拉框内容（亚马逊平台-阿联酋）  // div[contains(text(), "选择订单来源渠道")] / following - sibling::div[contains(text(), "亚马逊平台-阿联酋")]
    text_ddlyqd_select =(By.XPATH,'// div[contains(text(), "选择订单来源渠道")] / following - sibling::div[contains(text(), "亚马逊平台-阿联酋")]')

    #添加产品按钮  //span[text()="添加产品"]   进入到新的内嵌页 Customer_order_OpenIframeWin2
    button_add_product =(By.XPATH,'//span[text()="添加产品"]')

    #公司名输入框
    input_company_name = (By.XPATH,'//th[contains(text(),"公司名")]//following::input[@id="_easyui_textbox_input4"]')

    #收货人1
    input_addressee1 =(By.XPATH,'//th[contains(text(),"收货人")]//following::input[@id="_easyui_textbox_input5"]')
    #收货人2
    input_addressee2 = (By.XPATH,'//th[contains(text(),"收货人")]//following::input[@id="_easyui_textbox_input6"]')
    #email输入框
    input_email = (By.XPATH,'//th[contains(text(),"电子邮件")]//following::input[@id="_easyui_textbox_input7"]')
    #联系电话
    input_phone = (By.XPATH,'//th[contains(text(),"联系电话")]//following::input[@id="_easyui_textbox_input8"]')
    #证件/税号
    input_certificate_taxnumber = (By.XPATH,'//th[contains(text(),"证件/税号")]//following::input[@id="_easyui_textbox_input9"]')
    #收货人地址下拉框按钮  //th[contains(text(),"收货人地区")]/parent::tr//input//following-sibling::span//a
    button_Consignee_region = (By.XPATH,'//th[contains(text(),"收货人地区")]/parent::tr//input//following-sibling::span//a')
    #收货人地区选择框
    select_Consignee_region = (By.XPATH,'//th[contains(text(),"收货人地区")]//following::input[@id="_easyui_textbox_input48"]')
    #地址1输入框
    input_address1 =(By.XPATH,'//th[contains(text(),"地址1")]//following::input[@id="_easyui_textbox_input13"]')
    #邮编输入框
    input_postal_code =(By.XPATH,'//th[contains(text(),"邮编")]//following::input[@id="_easyui_textbox_input17"]')
    #发货仓库下拉框按钮  //input[contains(@placeholder,"发货仓库（输入搜索）")]/preceding-sibling::span//a
    button_Delivery_warehouse =(By.XPATH,'//input[contains(@placeholder,"发货仓库（输入搜索）")]/preceding-sibling::span//a')
    #运输方式下拉框按钮  //input[contains(@placeholder,"运输方式（输入搜索）")]/preceding-sibling::span//a
    button_type_of_shipping = (By.XPATH,'//input[contains(@placeholder,"运输方式（输入搜索）")]/preceding-sibling::span//a')
    #货币类型下拉框按钮  //input[contains(@placeholder,"订单币种（输入搜索）")]/preceding-sibling::span//a
    button_Currency_type = (By.XPATH,'//input[contains(@placeholder,"订单币种（输入搜索）")]/preceding-sibling::span//a')
    #支付方式下拉框按钮  //input[contains(@placeholder,"支付方式")]/preceding-sibling::span//a
    button_Payment_method = (By.XPATH,'//input[contains(@placeholder,"支付方式")]/preceding-sibling::span//a')
    #保存按钮 //a[@id="btnSave"]/span
    button_save = (By.XPATH,'//a[@id="btnSave"]/span')
    #弹框订单创建成功
    notification_order_create_success = (By.XPATH,'//div[contains(text(),"订单创建成功")]')
class Customer_order_OpenIframeWin2:

    # frame_iframeSubMenu>frame_OpenIframeWin1 >frame_OpenIframeWin2
    #frame:  直接切入到下面的iframe
    frame_OpenIframeWin2 =(By.XPATH,'//iframe[@name="OpenIframeWin" and contains(@src,"/IrobotBox/Product/ProductSelect.aspx?")]')

    #系统Sku输入框
    input_systemSku =(By.ID,"TextSearch")

    #搜索按钮
    button_search = (By.XPATH,'//div[@class="datagrid-toolbar"]//span[text()="搜索" and @class="l-btn-text icon-search"]')

    #产品列表单选框
    radio_product = (By.ID,'CheckboxBrand')

    #选择按钮
    botton_select = (By.XPATH,'//form[@id="form1"]//span[text()="选择"]')

